package com.wyh.util;

import com.wyh.bean.ConsumerComponent;

/**
 * @author wuyuhan
 * @date 2021/1/27 19:33
 */
public class Consume implements Runnable {

    private ConsumerComponent service;
    private String method;

    public Consume(ConsumerComponent s, String m) {
        this.service = s;
        this.method = m;
    }
    private void call() {
        if(method == "A") {
            String s = service.methodA(method);
        } else if(method == "B") {
            service.methodB(method);
        } else if(method == "C") {
            service.methodC(method);
        }
    }

    @Override
    public void run() {
        while (true){
            call();
        }
    }
}
